1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.lucene.classification;
18
19 import org.apache.lucene.analysis.MockAnalyzer;
20 import org.apache.lucene.index.Term;
21 import org.apache.lucene.search.TermQuery;
22 import org.junit.Test;
23
24
25
26
27 public class BooleanPerceptronClassifierTest extends ClassificationTestBase<Boolean> {
28
29 @Test
30 public void testBasicUsage() throws Exception {
31 checkCorrectClassification(new BooleanPerceptronClassifier(), TECHNOLOGY_INPUT, false, new MockAnalyzer(random()), textFieldName, booleanFieldName);
32 }
33
34 @Test
35 public void testExplicitThreshold() throws Exception {
36 checkCorrectClassification(new BooleanPerceptronClassifier(100d, 1), TECHNOLOGY_INPUT, false, new MockAnalyzer(random()), textFieldName, booleanFieldName);
37 }
38
39 @Test
40 public void testBasicUsageWithQuery() throws Exception {
41 checkCorrectClassification(new BooleanPerceptronClassifier(), TECHNOLOGY_INPUT, false, new MockAnalyzer(random()), textFieldName, booleanFieldName, new TermQuery(new Term(textFieldName, "it")));
42 }
43
44 @Test
45 public void testPerformance() throws Exception {
46 checkPerformance(new BooleanPerceptronClassifier(), new MockAnalyzer(random()), booleanFieldName);
47 }
48
49 }